<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<button onclick="myFunction()">点我</button>

<div id="myDIV">
    这是 DIV 元素。
</div>

</body>
<script>
    function myFunction() {
        if (document.getElementById("myDIV").style.display === "block") {
            document.getElementById("myDIV").style.display = "none"
        } else {
            document.getElementById("myDIV").style.display = "block"
        }

    }

</script>
<style>
    #myDIV {
        background-color: #ADD8E6;
        margin-top: 3%;
        padding-top: 3%;
        height: 15%;
        text-align: center;
        display: none;
    }
</style>

</html>